package com.example.service.impl;

import com.example.dao.UserDao;
import com.example.dao.impl.UserDaoImpl;
import com.example.model.User;
import com.example.service.UserService;
import com.example.vo.Page;

import java.util.List;
import java.util.Map;

public class UserServiceImpl implements UserService {

    @Override
    public Page<User> selectPageByCondition(Map<String,String>params){
        Page<User> page = new Page<>();
        UserDao userDao = new UserDaoImpl();
        List<User> list = userDao.getUsersByCondition(params);
        page.setRecords(list);
        //根据条件进行查询总条数
        int total = userDao.getTotal(params);
        page.setCount(total);
        page.setPageSize(5);
        return page;
    }
}
